package tt.dz.util;

/**
 * @Title 订单系统常量类
 * @author zhoutian   
 * @date 2015-11-26
 */
public class OrderConstant {
	/** 15分钟的毫秒整数值 */
	public static final int Fifteen_MINUTE_INT = 1000 * 60 * 15;
	
	/** 电桩 自己的运营商编号 */
	public static final String DZMerchantCode = "";
	/** 账单上传:电量最大值 */
	public static final String UPLOAD_BILL_CHARGE_POWER_MAX = "300";
	/** 账单上传:充电金额最大值 */
	public static final String UPLOAD_BILL_CHARGE_CHARGING_MAX = "600";
	/** 账单上传:预约金额最大值 */
	public static final String UPLOAD_BILL_CHARGE_BESPEAK_MAX = "100";
	/** 账单上传:服务金额最大值 */
	public static final String UPLOAD_BILL_CHARGE_SERVICE_MAX = "600";
	
	/**
	 * 服务枚举
	 * @author zhoutian
	 */
	public static enum OrderServiceEnum {
		Charge("100", "充电"),
		ChargeService("100001", "充电服务"),
		CollectingElectricityFee("100002", "代收电费服务"),
		Reservation("100003", "充电预约服务"),
		Appointment("200", "预约"),
		ChargeAppointmentRefund("200002", "充电预约退款服务");
		
		private String value = null;
		private String desc = null;
		
		private OrderServiceEnum(String v, String desc) {
	        this.value = v;
	        this.desc = desc;
	    }
		
		public String value() {
	        return this.value;
	    }
		
		public String desc() {
	        return this.desc;
	    }
		
		public static String getDesc(String value){
			if(value == null) return null;
			for(OrderServiceEnum se : OrderServiceEnum.values()){
				if(se.value.equals(value)){
					return se.desc();
				}
			}
			return null;
		}
	}
	
	public static enum UserType {
		persnal(0, "个人客户"),
		enterprise(1, "企业客户"),
		unifyPay(2, "支持统付的个人客户");
		
		private int value = 0;
		private String desc = null;
		
		private UserType(int v, String desc) {
	        this.value = v;
	        this.desc = desc;
	    }
		
		public int value() {
	        return this.value;
	    }
		
		public String desc() {
	        return this.desc;
	    }
	}
	
	/**
	 * 卡类型 08 线上卡，06 线下卡（现金卡），05 线下卡（身份认证卡）
	 */
	public static enum CardType {
		ONLINE_CARD("08", "08 线上卡"),
		OFFLINE_CARD("06", "06 线下卡（现金卡）"),
		IDENTITY_CARD("05", "05 线下卡（身份认证卡）");

		private String value;
		private String desc;

		private CardType(String value, String desc) {
			this.value = value;
			this.desc = desc;
		}

		public String value() {
			return this.value;
		}

		public String toString() {
			return this.value + ":" + this.desc;
		}

		public String getDesc() {
			return desc;
		}
	}
	
	public static enum OrderStatus {
		unPay(0, "已下单，未支付"),
		paying(1, "正在支付"),
		unAudit(2, "未审核"),
		auditing(3, "正在审核"),
		confirmed(4, "已确认"),
		stocking(5, "备货中"),
		delivered(6, "已发货"),
		payedDone(7, "已支付，已完成"),
		canceledDone(8, "已取消，已完成"),
		overdueDone(9, "已超期，已完成");//充电预约订单超过可取消的期限，不能退款
		
		private int value = 0;
		private String desc = null;
		
		private OrderStatus(int v, String desc) {
	        this.value = v;
	        this.desc = desc;
	    }
		
		public int value() {
	        return this.value;
	    }
		
		public String desc() {
	        return this.desc;
	    }
		
		public static String getDesc(Integer value){
			if(value == null) return null;
			for(OrderStatus se : OrderStatus.values()){
				if(se.value == value){
					return se.desc();
				}
			}
			return null;
		}
	}
	
	public static enum ProviderServiceStatus {
		disable(0, "停用"),
		enable(1, "启用");
		
		private int value = 0;
		private String desc = null;
		
		private ProviderServiceStatus(int v, String desc) {
	        this.value = v;
	        this.desc = desc;
	    }
		
		public int value() {
	        return this.value;
	    }
		
		public String desc() {
	        return this.desc;
	    }
	}
	
	/**
	 * 支付方式
	 */
	public static enum OrderPayWay {
		thirdImmediately(1, "第三实时支付"),
		unify(2, "统付"),
		enterprise(3, "企业支付"),
		electronicPurse(4, "电子钱包支付"),
		substitute(5, "代付"),
		offLineCard(6, "线下卡支付");
		
		private int value = 0;
		private String desc = null;
		
		private OrderPayWay(int v, String desc) {
	        this.value = v;
	        this.desc = desc;
	    }
		
		public int value() {
	        return this.value;
	    }
		
		public String desc() {
	        return this.desc;
	    }
		
		public static String getDesc(Integer value){
			if(value == null) return null;
			for(OrderPayWay se : OrderPayWay.values()){
				if(se.value == value){
					return se.desc();
				}
			}
			return null;
		}
	}
	
	/**
	 * 支付状态
	 */
	public static enum OrderPayStatus {
		payed(1, "已支付/支付成功"),
		unpay(2, "待支付"),
		paying(3, "支付中"),
		payFail(4, "支付失败"),
		payTimeOut(5, "支付超时");
		
		private int value = 0;
		private String desc = null;
		
		private OrderPayStatus(int v, String desc) {
	        this.value = v;
	        this.desc = desc;
	    }
		
		public int value() {
	        return this.value;
	    }
		
		public String desc() {
	        return this.desc;
	    }
	}
	
	/**
	 * 支付渠道编码
	 */
	public static enum OrderPayChannelCode {
		youbei(0, "有贝先付"),
		alipay(1, "支付宝"),
		weixin(2, "微信支付");
		
		private int value = 0;
		private String desc = null;
		
		private OrderPayChannelCode(int v, String desc) {
	        this.value = v;
	        this.desc = desc;
	    }
		
		public int value() {
	        return this.value;
	    }
		
		public String desc() {
	        return this.desc;
	    }
		
		public static String getDesc(Integer value){
			if(value == null) return null;
			for(OrderPayChannelCode se : OrderPayChannelCode.values()){
				if(se.value == value){
					return se.desc();
				}
			}
			return null;
		}
	}
	
	/**
	 * 订单发送台帐状态
	 */
	public static enum AccountingStatus {
		needSendNew(0, "支付完成，需要发送"),
		needSendAgain(1, "发送返回失败，需要再次发送"),
		sending(2, "正在发送"),
		success(3, "发送并返回成功");
		
		private int value = 0;
		private String desc = null;
		
		private AccountingStatus(int v, String desc) {
	        this.value = v;
	        this.desc = desc;
	    }
		
		public int value() {
	        return this.value;
	    }
		
		public String desc() {
	        return this.desc;
	    }
	}
	
	/**
	 * 发送充电预约退款订单的状态
	 */
	public static enum SendRefundStatus {
		needSendNew(0, "新生成，需要发送"),
		needSendAgain(1, "返回失败，需要再次发送"),
		sending(2, "正在发送"),
		success(3, "成功返回并处理成功");
		
		private int value = 0;
		private String desc = null;
		
		private SendRefundStatus(int v, String desc) {
	        this.value = v;
	        this.desc = desc;
	    }
		
		public int value() {
	        return this.value;
	    }
		
		public String desc() {
	        return this.desc;
	    }
	}
	
	/**
	 * 是否分润标志
	 */
	public static enum DividedFlag {
		no(0, "否"),
		yes(1, "是");
		
		private int value = 0;
		private String desc = null;
		
		private DividedFlag(int v, String desc) {
	        this.value = v;
	        this.desc = desc;
	    }
		
		public int value() {
	        return this.value;
	    }
		
		public String desc() {
	        return this.desc;
	    }
	}
	
	/**
	 * 支付宝支付交易状态码
	 */
	public static enum AliPayTradeStatus {
		TRADE_FINISHED("TRADE_FINISHED", "交易成功"),
		TRADE_SUCCESS("TRADE_SUCCESS", "支付成功"),
		WAIT_BUYER_PAY("WAIT_BUYER_PAY", "交易创建"),
		TRADE_CLOSED("TRADE_CLOSED", "交易关闭");
		
		private String value = null;
		private String desc = null;
		
		private AliPayTradeStatus(String v, String desc) {
	        this.value = v;
	        this.desc = desc;
	    }
		
		public String value() {
	        return this.value;
	    }
		
		public String desc() {
	        return this.desc;
	    }
	}
	
	/**
	 * 业务系统编码
	 */
	public static enum BizSystemCode {
		MainServer("101", "主服务器"),
		OrderServer("102", "订单服务器"),
		OMS("103", "综合运营管理服务器"),
		DzApp("104", "电桩APP"),
		LeTV("201", "乐视APP"),
		Dz("000", "充电桩");
		
		private String value = null;
		private String desc = null;
		
		private BizSystemCode(String v, String desc) {
	        this.value = v;
	        this.desc = desc;
	    }
		
		public String value() {
	        return this.value;
	    }
		
		public String desc() {
	        return this.desc;
	    }
	}
	
	/**
	 * 订单系统运营管理操作员登录结果
	 */
	public static enum LoginForOperResult {
		fail(0, "失败"),
		success(1, "成功");
		
		private int value = 0;
		private String desc = null;
		
		private LoginForOperResult(int v, String desc) {
	        this.value = v;
	        this.desc = desc;
	    }
		
		public int value() {
	        return this.value;
	    }
		
		public String desc() {
	        return this.desc;
	    }
	}
	
	/**
	 * 运营商经营方式
	 */
	public static enum MerchantOperationMode {
		cooperative(0, "合作经营"),
		principal(1, "自营");
		
		private int value = 0;
		private String desc = null;
		
		private MerchantOperationMode(int v, String desc) {
	        this.value = v;
	        this.desc = desc;
	    }
		
		public int value() {
	        return this.value;
	    }
		
		public String desc() {
	        return this.desc;
	    }
	}
	
	/**
	 * CRUD操作枚举
	 */
	public static enum CRUDCode {
		Create("C", "新增"),
		Retrieve("R", "读取"),
		Update("U", "修改"),
		Delete("D", "删除");
		
		private String value = null;
		private String desc = null;
		
		private CRUDCode(String v, String desc) {
	        this.value = v;
	        this.desc = desc;
	    }
		
		public String value() {
	        return this.value;
	    }
		
		public String desc() {
	        return this.desc;
	    }
	}
	
	/**
	 * 业务类型：0 业务， 1 job，2 rpc，9 其它
	 */
	public static enum BizType {
		/**
		 * 业务
		 */
		BUSINESS("0", "业务"),
		/**
		 * JOB
		 */
		JOB("1", "JOB"),
		/**
		 * RPC
		 */
		RPC("2", "RPC"),
		/**
		 * 其它
		 */
		OTHER("9", "其它");

		private String value;
		private String desc;

		private BizType(String value, String desc) {
			this.value = value;
			this.desc = desc;
		}

		public String value() {
			return this.value;
		}

		public String toString() {
			return this.value;
		}
		 

		public String getDesc() {
			return desc;
		}
	}
}